package com.example.cuckoofilterdemo.config;

import com.example.cuckoofilterdemo.filter.RedisCuckooFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

@Configuration
public class CuckooFilterConfig {
    @Value("${cuckoo.filter.max-kicks:500}")
    private int maxKicks;

    @Value("${cuckoo.filter.fingerprint-size:4}")
    private int fingerprintSize;

    @Bean
    public RedisCuckooFilter redisCuckooFilter(StringRedisTemplate redisTemplate) {
        return new RedisCuckooFilter(redisTemplate, maxKicks, fingerprintSize);
    }
}
